package high.concurrent.pay.strategypattern.callback;

import high.concurrent.pay.service.PayCallbackService;
import high.concurrent.vo.PayInfoVO;

import java.util.List;

/**
 * 支付回调上下问策略模式
 */
public class PayCallbackContext {

    private PayCallbackService payCallbackInterface;

    public PayCallbackContext(PayCallbackService payCallbackInterface){
        this.payCallbackInterface = payCallbackInterface;
    }

    /**
     * 向各服务发送消息， 消息标识待发送
     * @param payInfoVO
     * @return
     */
    public List<String> toBeSend(PayInfoVO payInfoVO){

        return this.payCallbackInterface.toBeSend(payInfoVO);
    }

    /**
     * 修改本地事务
     * @param payInfoVO
     */
    public void updateLocalTransaction(PayInfoVO payInfoVO){
        this.payCallbackInterface.updateLocalTransaction(payInfoVO);
    }

    /**
     * 向各服务发送消息， 消息标识为已发送
     * @param messageIds
     */
    public void hasBeenSent(List<String> messageIds){
        payCallbackInterface.hasBeenSent(messageIds);
    }

}
